***********************************************************************************************
																							  *
* Forced Displacement and Asylum Policy in the Developing World							 	  *
																							  *
* Christopher W. Blair, Guy Grossman, and Jeremy Weinstein									  *
* cwblair@sas.upenn.edu																	      *
* May 2021															    					  *
																							  *
***********************************************************************************************

clear all
set more off
set scheme plotplainblind
macro drop _all
estimates drop _all
set matsize 800
set seed 8675309

** SET YOUR FILE PATH

cd "~/Dropbox/Immigration/Analysis/Policy Diffusion/Replication Files/"

use "index_scores.dta"
estimates drop _all

xtset ccode2 year

tab ccode, gen(CC)

******************************************* FIGURE 2 ****************************************************

preserve

foreach x of var CC* {
replace `x'=`x'*policy_index
}

collapse (mean) policy_index (max) CC*, by(year)

tw (tsline CC1-CC20, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC21-CC40, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC41-CC60, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC61-CC80, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC81-CC92, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid)) (tsline policy_index, lcolor(black) lpatt(solid) lwidth(thick)), legend(off) xlabel(1951(6)2017, tlength(*1.45)) xmtick(1951(1)2017, tlength(*1.75)) ylabel(0(.1)1, tlength(*1.45)) ymtick(0(.05)1, tlength(*1.75)) xtitle("Year", size(medium)) ytitle("Policy Index Score", size(medium))

restore

preserve

foreach x of var CC* {
replace `x'=`x'*access_field
}

collapse (mean) access_field (max) CC*, by(year)

tw (tsline CC1-CC20, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC21-CC40, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC41-CC60, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC61-CC80, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC81-CC92, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid)) (tsline access_field, lcolor(black) lpatt(solid) lwidth(thick)), legend(off) xlabel(1951(6)2017, tlength(*1.45)) xmtick(1951(1)2017, tlength(*1.75)) ylabel(0(.1)1, tlength(*1.45)) ymtick(0(.05)1, tlength(*1.75)) xtitle("Year", size(medium)) ytitle("Access Index Score", size(medium))

restore

preserve

foreach x of var CC* {
replace `x'=`x'*services_field
}

collapse (mean) services_field (max) CC*, by(year)

tw (tsline CC1-CC20, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC21-CC40, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC41-CC60, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC61-CC80, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC81-CC92, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid)) (tsline services_field, lcolor(black) lpatt(solid) lwidth(thick)), legend(off) xlabel(1951(6)2017, tlength(*1.45)) xmtick(1951(1)2017, tlength(*1.75)) ylabel(0(.1)1, tlength(*1.45)) ymtick(0(.05)1, tlength(*1.75)) xtitle("Year", size(medium)) ytitle("Services Index Score", size(medium))

restore

preserve

foreach x of var CC* {
replace `x'=`x'*livelihoods_field
}

collapse (mean) livelihoods_field (max) CC*, by(year)

tw (tsline CC1-CC20, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC21-CC40, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC41-CC60, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC61-CC80, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC81-CC92, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid)) (tsline livelihoods_field, lcolor(black) lpatt(solid) lwidth(thick)), legend(off) xlabel(1951(6)2017, tlength(*1.45)) xmtick(1951(1)2017, tlength(*1.75)) ylabel(0(.1)1, tlength(*1.45)) ymtick(0(.05)1, tlength(*1.75)) xtitle("Year", size(medium)) ytitle("Livelihoods Index Score", size(medium))

restore

preserve

foreach x of var CC* {
replace `x'=`x'*movement_field
}

collapse (mean) movement_field (max) CC*, by(year)

tw (tsline CC1-CC20, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC21-CC40, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC41-CC60, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC61-CC80, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC81-CC92, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid)) (tsline movement_field, lcolor(black) lpatt(solid) lwidth(thick)), legend(off) xlabel(1951(6)2017, tlength(*1.45)) xmtick(1951(1)2017, tlength(*1.75)) ylabel(0(.1)1, tlength(*1.45)) ymtick(0(.05)1, tlength(*1.75)) xtitle("Year", size(medium)) ytitle("Movement Index Score", size(medium))

restore

preserve

foreach x of var CC* {
replace `x'=`x'*participation_field
}

collapse (mean) participation_field (max) CC*, by(year)

tw (tsline CC1-CC20, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC21-CC40, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC41-CC60, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC61-CC80, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline CC81-CC92, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid)) (tsline participation_field, lcolor(black) lpatt(solid) lwidth(thick)), legend(off) xlabel(1951(6)2017, tlength(*1.45)) xmtick(1951(1)2017, tlength(*1.75)) ylabel(0(.1)1, tlength(*1.45)) ymtick(0(.05)1, tlength(*1.75)) xtitle("Year", size(medium)) ytitle("Participation Index Score", size(medium))

restore


******************************************* FIGURE 3 ****************************************************

use "hattonindex.dta", clear
estimates drop _all

tab dcode, gen(CC)

preserve

foreach x of var CC* {
replace `x'= poltot*`x'
}

foreach i of num 1/19 {
replace CC`i'=. if dcode!=`i'
 }
 
collapse (mean) poltot (min) CC*, by(year)

foreach x of var CC* poltot {
replace `x'=`x'*-1
}

tsset year

tw (tsline CC1-CC19, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid))  (tsline poltot, lcolor(black) lpatt(solid) lwidth(thick)), legend(off) xlabel(1997(1)2012, tlength(*1.45)) ylabel(-11(1)5, tlength(*1.45)) xtitle("Year", size(medium)) ytitle("Asylum Policy Index (Hatton)", size(medium))

restore

preserve

foreach x of var CC* {
replace `x'= polacc*`x'
}

foreach i of num 1/19 {
replace CC`i'=. if dcode!=`i'
 }
 
collapse (mean) polacc (min) CC*, by(year)

foreach x of var CC* polacc {
replace `x'=`x'*-1
}

tsset year

tw (tsline CC1-CC19, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid))  (tsline polacc, lcolor(black) lpatt(solid) lwidth(thick)), legend(off) xlabel(1997(1)2012, tlength(*1.45)) ylabel(-4(1)2, tlength(*1.45)) xtitle("Year", size(medium)) ytitle("Access Policy Index (Hatton)", size(medium))

restore

preserve

foreach x of var CC* {
replace `x'= polpro*`x'
}

foreach i of num 1/19 {
replace CC`i'=. if dcode!=`i'
 }
 
collapse (mean) polpro (min) CC*, by(year)

foreach x of var CC* polpro {
replace `x'=`x'*-1
}

tsset year

tw (tsline CC1-CC19, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid))  (tsline polpro, lcolor(black) lpatt(solid) lwidth(thick)), legend(off) xlabel(1997(1)2012, tlength(*1.45)) ylabel(-6(1)4, tlength(*1.45)) xtitle("Year", size(medium)) ytitle("Processing Policy Index (Hatton)", size(medium))

restore

preserve

foreach x of var CC* {
replace `x'= polwel*`x'
}

foreach i of num 1/19 {
replace CC`i'=. if dcode!=`i'
 }
 
collapse (mean) polwel (min) CC*, by(year)

foreach x of var CC* polwel {
replace `x'=`x'*-1
}

tsset year

tw (tsline CC1-CC19, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid))  (tsline polwel, lcolor(black) lpatt(solid) lwidth(thick)), legend(off) xlabel(1997(1)2012, tlength(*1.45)) ylabel(-6(1)4, tlength(*1.45)) xtitle("Year", size(medium)) ytitle("Welfare Policy Index (Hatton)", size(medium))

restore

use "petersindex.dta", clear
estimates drop _all

tab ccode, gen(CC)

preserve

foreach x of var CC* {
replace `x'= borderregulations*`x'
}

replace CC1=. if ccode!=2
replace CC2=. if ccode!=20
replace CC3=. if ccode!=140
replace CC4=. if ccode!=160
replace CC5=. if ccode!=200
replace CC6=. if ccode!=210
replace CC7=. if ccode!=220
replace CC8=. if ccode!=225
replace CC9=. if ccode!=255
replace CC10=. if ccode!=560
replace CC11=. if ccode!=670
replace CC12=. if ccode!=690
replace CC13=. if ccode!=711
replace CC14=. if ccode!=713
replace CC15=. if ccode!=732
replace CC16=. if ccode!=740
replace CC17=. if ccode!=830
replace CC18=. if ccode!=900
replace CC19=. if ccode!=920
 
collapse (mean) borderregulations (min) CC*, by(year)

tsset year

tw (tsline CC1-CC19, lcolor(gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10 gs10) lpatt(solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid solid)) (tsline borderregulations, lcolor(black) lpatt(solid) lwidth(thick)), legend(off) xlabel(1952(4)2008, tlength(*1.45)) xmtick(1951(1)2010, tlength(*1.75)) ylabel(-3(1)1, tlength(*1.45)) xtitle("Year", size(medium)) ytitle("Border Regulations Index (Peters)", size(medium))

restore

clear
